<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!-- 引入 layui.css -->
    <link rel="stylesheet" href="//unpkg.com/layui@2.6.8/dist/css/layui.css">

    <!-- 引入 layui.js -->
    <script src="//unpkg.com/layui@2.6.8/dist/layui.js"></script>
    <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js">
    </script>
</head>
<body>
<form id="myform">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">入库单号</label>
            <div class="layui-input-inline">
                <input type="text" id="order_no" name="order_no"  autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">审核状态</label>
            <div class="layui-input-inline">
                <input type="text" name="status"  value="待审核" autocomplete="off" class="layui-input">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
    <div class="layui-inline">
        <label class="layui-form-label">入库门店</label>
        <div class="layui-input-inline">
            <input type="text" name="shop"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">入库类型</label>
        <div class="layui-input-inline">
            <select class="layui-select" name="type" id="type">
                <option value="">入库类型</option>
                <option value="其他入库">其他入库</option>
                <option  value="采购入库">采购入库</option>
                <option value="调拨入库">调拨入库</option>
                <option value="盘盈入库">盘盈入库</option>
                <option value="退货入库">退货入库</option>
            </select>
        </div>
    </div>
</div>
<div class="layui-form-item">
    <div class="layui-inline">
        <label class="layui-form-label">经办人员</label>
        <div class="layui-input-inline">
            <input type="text" name="do_people" placeholder="请输入经办人员"  autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-inline">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <input type="text"   autocomplete="off" class="layui-input">
        </div>
    </div>

</div>
<button type="button" class="layui-btn layui-btn-normal" onclick="change()">商品</button>
<button type="button" class="layui-btn layui-btn-normal sub">保存</button>
<button type="button" class="layui-btn layui-btn-normal check">审核</button>

<table class="layui-table table" style="display: none">
    <colgroup>
        <col width="150">
        <col width="150">
        <col width="200">
        <col>
    </colgroup>
    <thead>
    <tr>
        <th></th>
        <th>序号</th>
        <th>编码</th>
        <th>商品名称</th>
        <th>单位</th>
        <th>入库数量</th>
        <th>备注</th>
        <th>操作</th>
    </tr>
    </thead>
    <tbody>
    {foreach $data as $key=>$vo }
    <tr>
        <td><input type="checkbox" name="ckb-jobid" value="{$vo.id}"></td>
        <td>{$vo.id}</td>
        <td>{$vo.goods_no}</td>
        <td>{$vo.goods_name}</td>
        <td>{$vo.wei}</td>
        <td>{$vo.count}</td>
        <td></td>
        <td><a href="">删除</a></td>
    </tr>
    {/foreach}
    </tbody>
</table>
 <input type="hidden" name="ids" class="ids">
</form>
</body>
</html>
<script>
    function change(){
       var a= $(".table").css('display')
    if (a == 'none'){
        $(".table").css('display','table');
    }else {
        $(".table").css('display','none');
    }
    }

    $(".sub").on('click',function () {
        var  str='';
        $("input[name='ckb-jobid']:checked").each(function (index, item) {
            if ($("input[name='ckb-jobid']:checked").length-1==index) {
                str += $(this).val();
            } else {
                str += $(this).val() + ",";
            }
        });
        $(".ids").val(str);
        $.ajax({
            url:"{:url('save')}",
            data:$("#myform").serialize(),
            type:"post",
            dataType:"json",
            success(res){
                console.log(res);
            }
        })
    })
    
    $(".check").on('click',function () {
        var order_no = $("#order_no").val();
        location.href = "/admin/order/read?order_no="+order_no;
    })
</script>
